Repository navigation
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
TaranDahl
left a comment
There was a problem hiding this comment.
I see no other issues.
|
喵? |
Since this is your first PR submission, your code will need reviews from more maintainers before it can be merged. This is the rule of Phobos. |
OK, I will stop resolving the conflict before there are further results. |
There was a problem hiding this comment.
Pull request overview
This pull request refactors Phobos’ TechnoType conversion pipeline to support cross-category conversions (object replacement) across Infantry/Unit/Building types, adds a new BuildingType INI trigger (UndeploysInto.ConvertTo) to convert the undeployed unit on the next frame, and updates documentation/changelog/credits accordingly.
Changes:
- Added cross-category conversion via
TechnoExt::ConvertToTypeEx(create new object + destroy old), with deferred conversion support (PendingConvertTechnoType) processed inTechnoExt::OnEarlyUpdate. - Centralized status transfer during deploy/undeploy (mind control, shields, invulnerability, attached effects, multipliers, etc.) via
TechnoExt::SyncStatus. - Added deploy feedback improvements and documented the new conversion behaviors (including zh_CN locale updates and credits/changelog entries).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Misc/Hooks.BugFixes.cpp |
Switches deploy-to-fire checks to TechnoExt::CanDeployIntoBuilding. |
src/Ext/Unit/Hooks.DeploysInto.cpp |
Uses TechnoExt::SyncStatus, adds UndeploysInto.ConvertTo deferral, adds deploy action hook, adjusts deploy placement/desync logic. |
src/Ext/Unit/Hooks.DeployFire.cpp |
Adds NoDeploy feedback (EVA) when Convert.Deploy targets a building without sufficient space. |
src/Ext/Unit/Body.h |
Removes UnitExt deployer/static deploy checks now moved into TechnoExt. |
src/Ext/Unit/Body.cpp |
Removes UnitExt::Deployer and UnitExt::CanDeployIntoBuilding implementation. |
src/Ext/Techno/Body.Update.cpp |
Processes deferred conversions (PendingConvertTechnoType) during early update. |
src/Ext/Techno/Body.h |
Adds PendingConvertTechnoType, Deployer, and new conversion/status-transfer method declarations. |
src/Ext/Techno/Body.cpp |
Implements SyncStatus, moves deploy-related helpers into TechnoExt, and adds ConvertToTypeEx for cross-category conversions. |
src/Ext/BuildingType/Body.h |
Adds UndeploysInto_ConvertTo storage and declares a helper for deploy cell computation. |
src/Ext/BuildingType/Body.cpp |
Implements GetDeployBuildingTopLeftCell, reads/serializes UndeploysInto.ConvertTo. |
docs/Whats-New.md |
Adds changelog entries for cross-category conversion and related improvements. |
docs/New-or-Enhanced-Logics.md |
Documents UndeploysInto.ConvertTo. |
docs/Fixed-or-Improved-Logics.md |
Updates “fixed/improved” notes for conversion behavior and feedback. |
docs/locale/zh_CN/LC_MESSAGES/Whats-New.po |
Adds zh_CN translations for new changelog bullets. |
docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po |
Adds zh_CN translations for UndeploysInto.ConvertTo docs. |
docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po |
Updates zh_CN translations to match new conversion/feedback entries. |
docs/locale/zh_CN/LC_MESSAGES/CREDITS.po |
Adds zh_CN credits entries for the contributor. |
CREDITS.md |
Adds credits entries for the new conversion features and preservation behaviors. |
Suppressed comments (3)
src/Ext/Techno/Body.cpp:526
ConvertToTypeExcallsSyncStatus(which can transfer mind control, shields, attached effects, etc.) beforeForceCreate. IfForceCreatefails, the source unit's state may already have been mutated (e.g., mind control freed), leaving it in an inconsistent state.
SyncStatus(pThis, pBuilding);
pBuilding->QueueMission(Mission::Construction, false);
pBuilding->NextMission();
src/Ext/Techno/Body.cpp:576
ConvertToTypeExcallsSyncStatusbefore attemptingUnlimbothe new unit. IfUnlimbofails, the rollback path re-unlimbos the old unit but does not restore any state already transferred (mind control, attached effects, etc.). Move status transfer until after the new unit has been successfully placed.
if (auto const pUnit = static_cast<FootClass*>(pToType->CreateObject(pHouse)))
{
SyncStatus(pThis, pUnit);
// Remove old techno from map
pThis->Limbo();
src/Ext/Techno/Body.cpp:568
- PR description says cross-category conversion should not support
AircraftType(only same-type in-place conversion).ConvertToTypeExcurrently includesAbstractType::AircraftTypein the cross-type object-replacement path, which contradicts that behavior.
case AbstractType::InfantryType:
case AbstractType::UnitType:
case AbstractType::AircraftType:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
93a4943 to
1e729ed
Compare
Conversion was limited to types of the same class, and cross-class changes had to go through Ares. TechnoExt::ConvertToType now handles every combination: it creates the target object, hands over what can be carried across classes (target, destination, occupants, deploy state and the whole TechnoExt status including attached effects, shields and mind control), places the new object and unlinks the source. The conversion is split into two steps so callers can ask before anything is created: * TechnoExt::CanConvertToType does the checks without any side effect - both types have to differ, a building source must not be busy with its own mission, and a building target needs its whole foundation free where the source stands. * TechnoExt::ConvertToType performs the conversion and runs the same check again, so no caller can bypass it. A failed check no longer leaves a half-created object behind. Building placement is shared with the deploy checks: TechnoExt::CanCreateBuildingHere computes the top-left cell of the foundation and asks CanCreateHere while FootExt::Deployer marks the source, which FootExt::CanDeployIntoBuilding now reuses instead of duplicating it. ConvertToType_Phobos, the Ares converter bridge, TypeConvertGroup, the warhead Convert.Apply pair and the auto-convert actions all take a TechnoClass now, so buildings can be converted too; HealthAutoConvertActions moved from FootExt to TechnoExt for the same reason. Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
… type An infantry stands on one of the sub-positions of its cell, but the object it turns into belongs on the centre of that cell. A conversion that an infantry orders itself to do (Convert.Deploy / Convert.Undeploy) therefore walks it there first instead of converting it on the spot; infantry targets keep the sub-position, as the new infantry simply takes over. The walk belongs to the deploy path, not to the conversion itself: the Mission_Unload and the DoingAI deploy hooks start it through InfantryExt::PrepareConvertAtCellCenter and InfantryExt::HandlePendingConvertToTypeAtCenter finishes the conversion once the infantry has arrived. CellClass::FindInfantrySubposition never yields the centre on its own - index 0 is unreachable and the selection logic always rewrites it into 2..4 - so CellExt::InfantryCenterAllowed lets the hook in Ext/Cell/Hooks.cpp force the centre entry while the infantry walks. Plain MoveTo cannot do the hop: the walk AI drops any destination inside the infantry's own cell as "already arrived" and the order is silently lost. The spot is checked again on arrival: if another object has taken it in the meantime the conversion fails instead of stacking two objects on one cell, and the pending conversion is dropped so the cell's centre flag is released again. Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
[SomeBuilding] -> Convert.ShowBuildUp (default false) decides whether a conversion into or out of this building plays the buildup animation and its BuildingSlam sound. Buildings that should appear instantly when another object is converted into them - or that should disappear without the animation when they are converted away - can set it to no. Only conversions are affected. Regular DeploysInto / UndeploysInto deploys do not go through the conversion code and keep playing the buildup. Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
- Add "Convert TechnoType into any other type" section describing conversions across categories and to/from BuildingTypes, the new Convert.ShowBuildup / Convert.ShowBuildupFrom / Convert.ShowBuildupTo and Convert.Direction tags - Document Convert.Health.AfterBuildup, drop the outdated "does not support BuildingTypes" warnings (4x), note that Convert.Deploy / Convert.Undeploy accept any TechnoType and that infantry walks to the cell centre before converting - Add Whats-New 0.6 and CREDITS entries, plus zh_CN translations Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
…=true and buildings are in Selling state Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
What kind of change is this?
Skip Changelog).Skip Changelog,Skip Docs).Skip Docs).Skip Changelog,Skip Docs,Skip Credits).Description
Type conversion now works between any two TechnoTypes, including to and from
BuildingTypes.Convert,Convert.Deploy/Undeploy,Convert.Health,Ammo.AutoConvertType,Convert.HumanToComputer/Convert.ComputerToHumanand Ares' type conversion, with building placement checks, status transfer andConvert.Direction.Convert.ShowBuildup,Convert.ShowBuildupFrom,Convert.ShowBuildupTo,Convert.Direction,Convert.Health.AfterBuildup..poentries included.